package cn.wolfcode.enums;

import lombok.Getter;

@Getter
public enum ConsumptionReportEnum {
    BUSINESS("门店", "b.name"),
    YEAR("年", "DATE_FORMAT(c.pay_time,'%Y')"),
    MONTH("月", "DATE_FORMAT(c.pay_time,'%Y-%m')"),
    DAY("日", "DATE_FORMAT(c.pay_time,'%Y-%m-%d')");

    private String name;
    private String value;

    ConsumptionReportEnum(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public static String findName(Integer value) {
        //获取所有示例
        ConsumptionReportEnum[] enums = values();
        for (ConsumptionReportEnum anEnum : enums) {
            //判断实例中的value是否等于传入的value
            if (anEnum.value.equals(value)) {
                return anEnum.name;
            }
        }
        return null;
    }
}
